import { request } from '../http'

// 获取采集器列表（分页）
export function fetchCollectorList(params: { page?: number, pageSize?: number, name?: string, type?: string }) {
  return request.Get<Service.ResponseResult<Api.Collector.PageResponse>>('/api/collector/list', { params })
}

// 获取所有采集器
export function fetchAllCollectors() {
  return request.Get<Service.ResponseResult<Api.Collector.Info[]>>('/api/collectors')
}

// 获取单个采集器
export function fetchCollector(name: string) {
  return request.Get<Service.ResponseResult<Api.Collector.Info>>(`/api/collector/${name}`)
}

// 添加采集器
export function addCollector(data: Api.Collector.AddRequest) {
  return request.Post<Service.ResponseResult<null>>('/api/collector', data)
}

// 更新采集器
export function updateCollector(data: Api.Collector.UpdateRequest) {
  return request.Put<Service.ResponseResult<null>>('/api/collector', data)
}

// 删除采集器
export function deleteCollector(name: string) {
  return request.Delete<Service.ResponseResult<null>>(`/api/collector/${name}`)
}

